<!<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>第九章</title>
</head>
<body>
    
    <div id="app">
        <ele></ele>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script type="text/javascript">
        Vue.component('ele',{
            render: function(createElement){
                return createElement(
                    "div",
                    {
                        attrs: {
                            id: 'element'
                        },
                        class: {
                            'show': this.show
                        },
                        on: {
                            click: this.handleClick
                        }
                    },
                    '文本内容'
                )
            },
            data: function(){
                return{
                    show:true
                }
            },
            methods: {
                handleClick: function(){
                    console.log('clicked!');
                }
            }
        })

        var app = new Vue({
            el: '#app'
        })
    </script>
</body>
</html>